package cn.lijiajia3515.cairo.captcha;

import cn.hutool.core.util.RandomUtil;

import java.util.List;

/**
 * 委派 验证码 处理器
 */
public class DelegatingCaptchaHandler implements CaptchaHandler {
	private final List<? extends CaptchaHandler> handlers;

	public DelegatingCaptchaHandler(List<? extends CaptchaHandler> handlers) {
		this.handlers = handlers;
	}

	@Override
	public Captcha getCaptcha(CaptchaArgs args) {
		return handlers.get(RandomUtil.randomInt(handlers.size())).getCaptcha(args);
	}


}
